/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.InputMismatchException;
import java.util.Scanner;

/**
 * <p>Project: jse2204 - Exception3
 * <p>Powered by webrx On 2022-09-16 11:25:39
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Exception3 {
    public static void main(String[] args) {


        //String s = null;
        //System.out.println(s.toLowerCase());

        Scanner sc = new Scanner(System.in);
        while (true) {
            try {
                System.out.print("请输入a:");
                int a = sc.nextInt();
                System.out.print("请输入b:");
                int b = sc.nextInt();
                System.out.println(a / b);
                break;
            } catch (InputMismatchException ie) {
                System.out.println("输入错误，请输入整数");
                if(sc.hasNext()) sc.next();
            } catch (ArithmeticException ae) {
                System.out.println("输入错误，第二个数不输入0");
            } catch (Exception e) {
                System.out.println("程序未知错误");
            }
        }
        System.out.println("程序结束");
    }
}
